package com.dmall.chapter03.section03;

/**
 * 使用傻递归
 * 时间复杂度：O(2^n)
 * 空间复杂度：
 * @author xiao1.wang
 * @date 2020-12-01 10:54:21
 */
public class Leetcode70V1 {
    public int climbStairs(int n) {
        return climbStair(n);
    }

    private int climbStair(int n) {
        if (n <= 2) {
            return n;
        }
        return climbStair(n - 1) + climbStair(n - 2);
    }

    public static void main(String[] args) {
        Leetcode70V1 leetcode70 = new Leetcode70V1();
        System.out.println(leetcode70.climbStairs(4));
    }
}
